import { Row, Card, Col, Icon } from 'antd';

import React from 'react';

import { Link } from 'umi';

import { Button } from 'antd/lib/radio';

interface AddItemBarProps {
  href?: string;
}

export const AddItemBar: React.FC<AddItemBarProps> = props => (
  <Card>
    <Row type="flex" justify="space-between" align="middle">
      <Col>
        <Icon type="unordered-list" />
        <span style={{ marginLeft: '5px' }}>数据列表</span>
      </Col>
      {props.href ? (
        <Col>
          <Link to={props.href!}>
            <Button>{props.children || '添加'}</Button>
          </Link>
        </Col>
      ) : null}
    </Row>
  </Card>
);
